﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ITAP.ShprossesBuilder.Manipulation
{
    public class CommandHotKeyPairs
    {
        private List<IModelComponentCommand> commands;
        private List<Keys[]> hotKeys;

        public CommandHotKeyPairs()
        {
            commands = new List<IModelComponentCommand>();
            hotKeys = new List<Keys[]>();
        }

        public void Add(IModelComponentCommand command, Keys controlKey, Keys key)
        {
            commands.Add(command);
            hotKeys.Add(new Keys[] { controlKey, key });
        }

        public IModelComponentCommand GetCommand(Keys controlKey, Keys key)
        {
            for (int i = 0; i < hotKeys.Count; i++)
            {
                Keys[] keys = hotKeys[i];
                if (keys[0] == controlKey && keys[1] == key)
                    return commands[i];                
            }
            return null;
        }
    }
}
